package com.shuyu.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.shuyu.common.enums.ProductType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@ApiModel(description = "活动产品表")
@TableName("tbl_activity_product")
public class ActivityProduct implements Serializable {
    private static final long serialVersionUID = -4615253586362217783L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "活动Id")
    private Integer activityId;
    @ApiModelProperty(value = "活动类型 1：集卡消卡；2：转盘；3：促销活动；4：积分活动")
    private Integer activityType;
    @ApiModelProperty(value = "参与活动产品ID")
    private Integer productId;
    @ApiModelProperty(value = "参与活动产品名字")
    private transient String productName;
    @ApiModelProperty(value = "折扣开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;
    @ApiModelProperty(value = "折扣结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    @ApiModelProperty(value = "产品类型")
    private transient String typeName;
    private transient Integer type;
    @ApiModelProperty(value = "产品价值")
    private transient Double price;

    @ApiModelProperty(value = "是否有折扣0没有折扣 1有折扣")
    private Integer discountStatus;
    @ApiModelProperty(value = "折扣比例0-100")
    private Integer discount;

    @ApiModelProperty(value = "所需积分")
    private Integer point;

    @ApiModelProperty(value = "活动概率")
    private Double rate;
    @ApiModelProperty(value = "集卡列表")
    private transient List<ActivityCollectCard> activityCollectCardList;


    private Date createTime;

    public String getTypeName() {
        return ProductType.getTypeName(type);
    }

    public ActivityProduct() {
    }

    public ActivityProduct(Integer activityId, Integer activityType, Integer productId, Date startTime, Date endTime, Integer discountStatus, Integer discount, Integer point, Double rate, Date createTime) {
        this.activityId = activityId;
        this.activityType = activityType;
        this.productId = productId;
        this.startTime = startTime;
        this.endTime = endTime;
        this.discountStatus = discountStatus;
        this.discount = discount;
        this.point = point;
        this.rate = rate;
        this.createTime = createTime;
    }
}
